Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/2 config #12

Merged
merged 21 commits into from
May 21, 2024
Merged

Feat/2 config #12

merged 21 commits into from
May 21, 2024

Conversation

AlexAxthelm
Copy link
Collaborator

@AlexAxthelm AlexAxthelm commented May 17, 2024

Provide tools for dealing with JSON parameters.

Key abilities gained in this PR:

  • Read JSON as either string or file
    • Exciting potential when used with commandArgs(trailingOnly = TRUE), provides for reading the params directly, and can specify the Rscript as the ENTRYPOINT, and then the JSON as the argument in docker run
  • Inherit other JSON files by specifying the directory where the file is as an argument to parse_params, and then specifying the basename in the inherit` key of the JSON (see tests for examples)
  • Validate the parsed and inherited parameters against a JSON schema

An example of a "normal" call would be something along the lines of:

cfg <- parse_params(
  json = commandArgs(trailingOnly = TRUE),
  inheritence_search_paths = system.file("params", package = "workflow.pacta"),
  schema_file = system.file("schema", "params_schema.json", package = "workflow.pacta")
)

@AlexAxthelm AlexAxthelm marked this pull request as ready for review May 20, 2024 14:06
@AlexAxthelm AlexAxthelm requested review from cjyetman and jdhoffa May 20, 2024 14:07
@AlexAxthelm AlexAxthelm self-assigned this May 21, 2024
@AlexAxthelm AlexAxthelm merged commit 97fb466 into main May 21, 2024
15 checks passed
@AlexAxthelm AlexAxthelm linked an issue May 21, 2024 that may be closed by this pull request
@AlexAxthelm AlexAxthelm deleted the feat/2-config branch May 21, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add functionality to read and parse JSON configurations
2 participants